package com.qfedu.service.impl;

import com.github.pagehelper.PageHelper;
import com.qfedu.dao.DeptDao;
import com.qfedu.pojo.Dept;
import com.qfedu.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author guo
 */
@Service
public class DeptServiceImpl implements DeptService {
    @Autowired
    private DeptDao deptDao;

    @Override
    public List<Dept> findAllDept(Integer page, Integer limit, String name) {
        PageHelper.startPage(page, limit);
        return deptDao.findAllDept(name);
    }

    @Override
    public void deleteDeptById(Integer id) {
        deptDao.deleteDeptById(id);
    }

    @Override
    public void addDept(Dept dept) {
        deptDao.addDept(dept);
    }

    @Override
    public Dept findById(Integer id) {
        return deptDao.findById(id);
    }

    @Override
    public void updateDeptById(Dept dept) {
        deptDao.updateDeptById(dept);
    }

}
